<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<link rel="preload" href="resources/hello.txt?from=fetch-api.html" as="fetch" crossorigin="use-credentials">
<body>
<script>
promise_test(t => {
  const url = 'resources/hello.txt?from=fetch-api.html';
  return fetch(new Request(url, {credentials: 'include'})).then(res => {
    return res.text();
  }).then(text => {
    assert_equals(text, 'hello\n');
  }).then(() => {
    let counter = 0;
    for (const entry of performance.getEntriesByType('resource')) {
      if (entry.name.endsWith(url)) {
        counter += 1;
      }
    }
    assert_equals(counter, 1);
  });
});
</script>

